//
//  EGMDateUtil.h
//  BlePedometer
//
//  Created by hh on 14-1-24.
//  Copyright (c) 2014年 egoman. All rights reserved.
//

#import <Foundation/Foundation.h>

#define ONE_DAY_SECOND (24*60*60)
#define ONE_HOUR_SECOND (60*60)
#define SECOND_BETWEEN_Y2K_AND_Y1970 946686600

@interface EGMDateUtil : NSObject

+(NSString*)formatDateString:(NSDate*)date;
+(NSString*)formatMsFromSecond:(NSInteger)totalSecond;
+(NSString*)formatTimeFromSecond:(NSInteger)totalSecond;
+(NSString*)getCurrentDateString;
+ (NSDate *)dateWithString:(NSString*)dateString;//fomat:2000-01-01
+(NSString *)formatDateTimeString:(NSDate *)date;
+(int)getAge:(NSString*) birthday;

+(UInt32)getCurrentSecondOverY2k;
+(NSDate*)getDateFromSecondOverY2k:(NSTimeInterval)secondOverY2k;
+(NSString*)getDateStringFromSecondOverY2k:(NSTimeInterval)secondOverY2k;
+(NSDateFormatter*)dateFormatter;

+(NSDateFormatter *)dateFormatterWithPattern:(NSString*)pattern;

+(NSString *)formatDate:(NSDate *)date withPattern:(NSString*)pattern;
+(NSString *)formatCompatDateString:(NSDate *)date;
+(NSString*)getCurrentCompatDateString;
+(NSString *)formatCompatDateTimeString:(NSDate *)date;
+(NSDate*)dateFromCompatDateString:(NSString*)dateString;
+(NSDate*)dateFromCompatDateTimeString:(NSString*)dateTimeString;

+(NSDate*)getDateFromSecondOverY1970:(NSTimeInterval)secondOverY1970;
+(NSString*)getDateStringFromSecondOverY1970:(NSTimeInterval)secondOverY1970;

+(NSString*)formatHourAndMinuteFromSecond:(NSInteger)totalSecond;
+(NSString*)formatMinuteSecondFromSecond:(NSInteger)totalSecond;
+(BOOL)isTodayString:(NSString*)dateString;
+(BOOL)isTodayCompat:(NSString*)compatDateString;
+(BOOL)isToday:(NSDate*)date;

+ (NSDate *)getY2kDate;
+ (NSDate *)getY1970Date;
+(NSInteger)getSecondOverY2k:(NSDate*)date;
+(NSInteger)get0ClockSecondOverY2k:(NSDate*)date;
+(NSString*)getDateTimeStringFromSecondOverY2k:(NSTimeInterval)secondOverY2k;
+(NSDate*)get0ClockDate:(NSDate*)date;

+(NSString*)toCompatDateString:(NSString*)dateString;
+(NSString*)toDateString:(NSString*)compatDateString;
+(NSString*)toDateTimeString:(NSString*)compatDateTimeString;

+(NSInteger)getCurrentClock;


+(NSString*)getCompatDateStringFromSecondOverY1970:(NSTimeInterval)secondOverY1970;
+(NSString*)getDateTimeStringFromSecondOverY1970:(NSTimeInterval)secondOverY1970;
+(NSString*)getCompatDateTimeStringFromSecondOverY1970:(NSTimeInterval)secondOverY1970;
+(NSString*)getGMTCompatDateTimeStringFromSecondOverY1970:(NSTimeInterval)secondOverY1970;

+(NSInteger)getSecondOverY1970FromCompatDateTimeString:(NSString*)compatDateTime;

+(NSString*)getCurrentDateTimeString;
+(NSDateFormatter *)dateFormatterWithPattern:(NSString*)pattern timeZone:(NSTimeZone*)timeZone;
+(NSDateFormatter *)dateFormatterOfGMTWithPattern:(NSString*)pattern;
+(NSString*)getCurrentCompatDateTimeString;
@end
